open Printf
open Tokenizer
open Parser
open Location
    
let main =
  if Array.length Sys.argv > 1 then 
    let fname = Sys.argv.(1) in
    let token_stream = tokenize (fetch_in_stream fname) in
    match (parse_toplevel token_stream) with
    | Ok xd -> printf "%s" (sprintf_located_value xd)
    | UnexpectedClosedParen loc -> printf "zamkłeś nawias %s" (sprintf_location loc)
    | UnexpectedEof -> printf "eof\n\nxd"
    | ValueAfterEnd -> printf "po co"
  else printf "NAZWE PLIKU DJAŻĘ"
         
